home *** CD-ROM | disk | FTP | other *** search
- ;FILE :SCRSAVE (Saves screen to integer array)
- ;USEAGE :SCRSAVE (ARRAY%(),AREA%) Save screen to arrary% starting at 2000*area%
- scrsave segment
- assume cs:scrsave
- push bp ;save bp
- mov bp,sp
- push ds ;save this too!
-
- les di,[bp+6] ;Calculate offset into array.
- mov ax,es:[di] ;Let's see where to go in array.
- mov bx,4000
- mul bx ;4000 bytes per page.
- mov di,ax ;This is offset into array.
- mov si,0 ;Start at begining of screen area.
- ;Let's figure out display address/color or monochrome?
- mov bx,0040h ;seg that has vid info.
- mov es,bx
- mov dx,es:[063h] ;base address of video port
- add dx,6 ;we want base+6
- mov ax,0b000h ;monochrome address
- mov bx,es:[010h] ;display mode set
- and bx,110000b ;mask off what we want
- cmp bx,110000b
- jz mono ;jump if monochrome is set.
- mov ah,0b8h ;base address of color
- mono: push ax ;No let's set source segment.
- pop ds
- mov es,[bp+10] ;Set ES to start of array. (Destination)
- mov cx,2000 ;Move 1000 words.
- cld ;Clear direction flag for string move.
- loopm: cli ;NO IRQS while I'm working!
- notyet: in al,dx ;read video board
- shr al,1 ;bit we want is 0
- jb notyet
- sti ;Let'm get outa the car and go potty
- nop ;pass some time folks
- cli
- notyet2:in al,dx
- shr al,1
- jnb notyet2
- movsw
- sti ;OK IRQS again
- loop loopm
-
- pop ds
- pop bp
-
-
- scrsave ends
- end